/*
 * Powered By [pkuWx]
 * Web Site: http://www.wuxi.ss.pku.edu.cn
 * Since 2015 - 2015
 */

package cn.edu.pku.wxlib.recommendation.model;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import cn.org.rapid_framework.util.DateConvertUtils;

import java.util.*;

import cn.edu.pku.wxlib.recommendation.model.*;
import cn.edu.pku.wxlib.recommendation.service.*;
import cn.edu.pku.wxlib.recommendation.vo.query.*;

import javacommon.base.*;
import javacommon.util.*;
import javacommon.page.Page;

/**
 * @version 1.0
 * @since 1.0
 */


public class Recommendation extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "Recommendation";
	public static final String ALIAS_RECOMMENDATION_ID = "recommendationId";
	public static final String ALIAS_USER_ID = "userId";
	public static final String ALIAS_CREATE_TIME = "createTime";
	public static final String ALIAS_STATE = "1未处理，2购买，3拒绝";
	public static final String ALIAS_NAME = "书名/报刊名";
	public static final String ALIAS_AUTHOR = "作者";
	public static final String ALIAS_PUBLISHER = "出版社";
	public static final String ALIAS_PUBLISH_TIME = "出版时间";
	public static final String ALIAS_REASON = "理由";
	public static final String ALIAS_PRICE = "价格";
	public static final String ALIAS_REMARK = "备注";
	public static final String ALIAS_SOURCE = "来源";
	public static final String ALIAS_ISBNOR_ISSN = "isbnorIssn";
	
	//date formats
	public static final String FORMAT_CREATE_TIME = DATE_FORMAT;
	public static final String FORMAT_PUBLISH_TIME = DATE_FORMAT;
	
	//columns START
    /** recommendationId       db_column: recommendationId */	
	
	private java.lang.Integer recommendationId;
    /** userId       db_column: userId */	
	@NotNull 
	private java.lang.Integer userId;
    /** createTime       db_column: createTime */	
	
	private java.util.Date createTime;
    /** 1未处理，2购买，3拒绝       db_column: state */	
	
	private java.lang.Integer state;
    /** 书名/报刊名       db_column: name */	
	@NotBlank @Length(max=128)
	private java.lang.String name;
    /** 作者       db_column: author */	
	@Length(max=32)
	private java.lang.String author;
    /** 出版社       db_column: publisher */	
	@Length(max=64)
	private java.lang.String publisher;
    /** 出版时间       db_column: publishTime */	
	
	private java.util.Date publishTime;
    /** 理由       db_column: reason */	
	@Length(max=256)
	private java.lang.String reason;
    /** 价格       db_column: price */	
	
	private java.lang.Double price;
    /** 备注       db_column: remark */	
	@Length(max=256)
	private java.lang.String remark;
    /** 来源       db_column: source */	
	@Length(max=64)
	private java.lang.String source;
    /** isbnorIssn       db_column: ISBNOrISSN */	
	@Length(max=13)
	private java.lang.String isbnorIssn;
	//columns END

	public Recommendation(){
	}

	public Recommendation(
		java.lang.Integer recommendationId
	){
		this.recommendationId = recommendationId;
	}

	public void setRecommendationId(java.lang.Integer value) {
		this.recommendationId = value;
	}
	
	public java.lang.Integer getRecommendationId() {
		return this.recommendationId;
	}
	public void setUserId(java.lang.Integer value) {
		this.userId = value;
	}
	
	public java.lang.Integer getUserId() {
		return this.userId;
	}
	public String getCreateTimeString() {
		return DateConvertUtils.format(getCreateTime(), FORMAT_CREATE_TIME);
	}
	public void setCreateTimeString(String value) {
		setCreateTime(DateConvertUtils.parse(value, FORMAT_CREATE_TIME,java.util.Date.class));
	}
	
	public void setCreateTime(java.util.Date value) {
		this.createTime = value;
	}
	
	public java.util.Date getCreateTime() {
		return this.createTime;
	}
	public void setState(java.lang.Integer value) {
		this.state = value;
	}
	
	public java.lang.Integer getState() {
		return this.state;
	}
	public void setName(java.lang.String value) {
		this.name = value;
	}
	
	public java.lang.String getName() {
		return this.name;
	}
	public void setAuthor(java.lang.String value) {
		this.author = value;
	}
	
	public java.lang.String getAuthor() {
		return this.author;
	}
	public void setPublisher(java.lang.String value) {
		this.publisher = value;
	}
	
	public java.lang.String getPublisher() {
		return this.publisher;
	}
	public String getPublishTimeString() {
		return DateConvertUtils.format(getPublishTime(), FORMAT_PUBLISH_TIME);
	}
	public void setPublishTimeString(String value) {
		setPublishTime(DateConvertUtils.parse(value, FORMAT_PUBLISH_TIME,java.util.Date.class));
	}
	
	public void setPublishTime(java.util.Date value) {
		this.publishTime = value;
	}
	
	public java.util.Date getPublishTime() {
		return this.publishTime;
	}
	public void setReason(java.lang.String value) {
		this.reason = value;
	}
	
	public java.lang.String getReason() {
		return this.reason;
	}
	public void setPrice(java.lang.Double value) {
		this.price = value;
	}
	
	public java.lang.Double getPrice() {
		return this.price;
	}
	public void setRemark(java.lang.String value) {
		this.remark = value;
	}
	
	public java.lang.String getRemark() {
		return this.remark;
	}
	public void setSource(java.lang.String value) {
		this.source = value;
	}
	
	public java.lang.String getSource() {
		return this.source;
	}
	public void setIsbnorIssn(java.lang.String value) {
		this.isbnorIssn = value;
	}
	
	public java.lang.String getIsbnorIssn() {
		return this.isbnorIssn;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("RecommendationId",getRecommendationId())
			.append("UserId",getUserId())
			.append("CreateTime",getCreateTime())
			.append("State",getState())
			.append("Name",getName())
			.append("Author",getAuthor())
			.append("Publisher",getPublisher())
			.append("PublishTime",getPublishTime())
			.append("Reason",getReason())
			.append("Price",getPrice())
			.append("Remark",getRemark())
			.append("Source",getSource())
			.append("IsbnorIssn",getIsbnorIssn())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getRecommendationId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof Recommendation == false) return false;
		if(this == obj) return true;
		Recommendation other = (Recommendation)obj;
		return new EqualsBuilder()
			.append(getRecommendationId(),other.getRecommendationId())
			.isEquals();
	}
}

